from froModuleDrivers.homeDeviceDriver import HomeDeviceDriver # 引用家居设备控制器驱动模块
from froModuleDrivers.nioManager import NioManager # 引用驱动管理模块
import time

# 驱动初始化
driver_entrance = HomeDeviceDriver("192.168.50.145", 4001)
manager = NioManager(driver_entrance)
manager.run()

# 门禁控制相关的3个API
# 获取到门禁的状态，打开情况是返回True，关闭的情况是返回False
print(driver_entrance.isDoorOpen(2))

# 打开门禁
driver_entrance.openDoor(2)
time.sleep(1)

# 关闭门禁
driver_entrance.closeDoor(2)

time.sleep(1)
# 等待指令执行完毕后系统退出
manager.shutdownGracefully()